using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommerceOne.Domains.IRepositories;
using CommerceOne.Models.Entities;
namespace CommerceOne.Domains.SqlRepositories
{
    public class SqlCountryRegionRepository : SqlRepositoryBase, ICountryRegionRepository
    {
        /// <summary>
        /// Gets all country region.
        /// </summary>
        /// <returns></returns>
        public List<CountryRegion> GetAllCountryRegion()
        {
            return this.SqlContext.CountryRegions.ToList();
        }

        /// <summary>
        /// Gets all country region.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public List<CountryRegion> GetAllCountryRegion(int id)
        {
            return this.SqlContext.CountryRegions.Where(x=>x.ID==id).ToList();
        }

        #region Singleton Instance
        private static SqlCountryRegionRepository _instance;
        public static SqlCountryRegionRepository Instance
        {
            get { return _instance ?? (_instance = new SqlCountryRegionRepository()); }
        }
        #endregion
    }
} 
